package com.android.driveuploader;

import android.app.IntentService;
import android.content.Intent;

import java.util.concurrent.TimeUnit;

public class WallpaperIntentService extends IntentService {
    /**
     * Creates an IntentService.  Invoked by your subclass's constructor.
     *
     * @param name Used to name the worker thread, important only for debugging.
     */
    public WallpaperIntentService(String name) {
        super(name);
    }

    public WallpaperIntentService() {
        super("");
    }

    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {
        super.onStartCommand(intent, flags, startId);
        return START_STICKY;
    }

    @Override
    protected void onHandleIntent(Intent workIntent) {
        // Gets data from the incoming Intent
        String dataString = workIntent.getDataString();
        WallpaperScheduler wps = new WallpaperScheduler(5); //TODO: working code
        wps.changeWallPapers(getApplicationContext(), MyActivity.driveService, MyActivity.downloadUrl, 1, TimeUnit.MINUTES);
        //workIntent.
        //...
        // Do work here, based on the contents of dataString
        //...
    }

}
